home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 5228 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.2 KB

  1. Path: yama.mcc.ac.uk!dmu!usenet
  2. From: Timothy Eves <se1te@dmu.ac.uk>
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Plugs Ins
  5. Date: Mon, 11 Mar 1996 19:42:22 +0000
  6. Organization: De Montfort Univerity
  7. Message-ID: <3144821E.794B@dmu.ac.uk>
  8. References: <Pine.SOL.3.91.960307160455.27918A@sirius> <Dnws3v.7o0@cix.compulink.co.uk>
  9. NNTP-Posting-Host: holst.cms.dmu.ac.uk
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (X11; I; OSF1 V3.2 alpha)
  14.  
  15. Jolyon Ralph wrote:
  16. > > I am writing a program, and would like to use Plugin code.  How do you
  17. > > load an executable Amiga file, and what, point the program counter at
  18. > > it?  (I am writing in assembler)  Someone said something about
  19. > > LoadSeg() - Do I use this?
  20. > You don't want to do that! The easiest and best way to do plug-in code is
  21. > to use the amiga shared library format (ie. xxx.library - although you
  22. > don't have to call it that). We use that for all the modules in
  23. > Photogenics. It's easy to write, easy to call from your code, and the OS
  24. > handles caching them in RAM and flushing them when no longer needed for
  25. > you.
  26. > Jolyon
  27.  
  28. Easiest?? I don't know... It's easiest from the point of view of loading into
  29. the app, but I think it makes the plugins themselves harder to write.
  30.  
  31. Any way I've checked and found out a way doing this using LoadSeg()
  32.  
  33. A seglist as returned by LoadSeg will has this structure:
  34.  
  35.     LONG pad    ;aligns the seg to long word boundry
  36.     LONG size    ;How big this segment is
  37.     APTR next_seg    ;The next segment in this seglist.
  38.     start of code
  39.          .
  40.          .
  41.  
  42. If you do a load seg you can then jump 3 LongWords into the pointer returned
  43. by LoadSeg() and start execution from there.
  44.  
  45. When you write you're code just make sure the 1st hunk of the object file
  46. contains you're start code and the 1st code line is a function.
  47.  
  48. Hmm... after all that perhaps the Library based method is easier...
  49. -- 
  50. ------------------------------------------------------------O----------------    
  51. Out of the gloom came a voice, "Smile  and  be  happy things| EMail To:
  52. could  be  worse",  it  said.  So I smiled and I was  happy,| se1te@dmu.ac.uk
  53. and  behold  things  did  get worse.                |
  54. ------------------------------------------------------------O----------------
  55.